{

 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "#!/usr/bin/env python\n",
    "#coding=utf-8\n",
    "\n",
    "from aliyunsdkcore.client import AcsClient\n",
    "from aliyunsdkcore.acs_exception.exceptions import ClientException\n",
    "from aliyunsdkcore.acs_exception.exceptions import ServerException\n",
    "\n",
    "# 创建 AcsClient 实例\n",
    "client = "  
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 风格迁移API"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{\"RequestId\":\"EAFFE09B-E681-4321-9FD5-BD3016EC9EAB\",\"Data\":{\"Url\":\"http://viapi-cn-shanghai-dha-filter.oss-cn-shanghai.aliyuncs.com/upload/result_/2020-7-18/invi__015950575325581006591_Z8yCxv.jpg?Expires=1595059332&OSSAccessKeyId=LTAI4FoLmvQ9urWXgSRpDvh1&Signature=MmBkWGozv8E6LowUz4KB3DimxRc%3D\"}}\n"
     ]
    }
   ],
   "source": [
    "from aliyunsdkimageenhan.request.v20190930.ExtendImageStyleRequest import ExtendImageStyleRequest\n",
    "\n",
    "request = ExtendImageStyleRequest()\n",
    "request.set_accept_format('json')\n",
    "\n",
    "# 输入主图和风格图\n",
    "request.set_MajorUrl(\"http://viapi-test.oss-cn-shanghai.aliyuncs.com/sanjiye-meizi/%E5%9B%BE%E5%83%8F%E5%A2%9E%E5%BC%BA/%E9%A3%8E%E6%A0%BC%E8%BF%81%E7%A7%BB.jpg\")\n",
    "request.set_StyleUrl(\"http://viapi-test.oss-cn-shanghai.aliyuncs.com/sanjiye-meizi/%E5%9B%BE%E5%83%8F%E5%A2%9E%E5%BC%BA/%E9%A3%8E%E6%A0%BC%E8%BF%81%E7%A7%BB1.jpg\")\n",
    "\n",
    "response = client.do_action_with_exception(request)\n",
    "\n",
    "# 获得图片的识别码，即请求标识，得到图像数据\n",
    "#RequestId的作用用户请求日志关联 项目间请求日志关联\n",
    "# python2:  print(response) \n",
    "\n",
    "print(str(response, encoding='utf-8'))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 超分辨率API"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{\"RequestId\":\"82BABEEB-E9EA-4D99-890F-FC2AC3F42E36\",\"Data\":{\"Url\":\"http://viapi-cn-shanghai-dha-filter.oss-cn-shanghai.aliyuncs.com/upload/result_/2020-7-18/invi__015950575347871006842_jt3UNt.jpg?Expires=1595059334&OSSAccessKeyId=LTAI4FoLmvQ9urWXgSRpDvh1&Signature=9cuFvFBkxRkdXNoNONH63bg1SBU%3D\"}}\n"
     ]
    }
   ],
   "source": [
    "from aliyunsdkimageenhan.request.v20190930.MakeSuperResolutionImageRequest import MakeSuperResolutionImageRequest\n",
    "\n",
    "request = MakeSuperResolutionImageRequest()\n",
    "request.set_accept_format('json')\n",
    "\n",
    "request.set_Url(\"http://viapi-test.oss-cn-shanghai.aliyuncs.com/sanjiye-meizi/%E5%9B%BE%E5%83%8F%E5%A2%9E%E5%BC%BA/%E5%9B%BE%E5%83%8F%E8%B6%85%E5%88%86.jpg\")\n",
    "\n",
    "response = client.do_action_with_exception(request)\n",
    "# python2:  print(response) \n",
    "print(str(response, encoding='utf-8'))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
